<!DOCTYPE html>
<html lang="zh-CN" ng-app="proApp">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Copcatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>EShop商品管理</title>
  <link href="libs/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="./css/product/style.css">
</head>
<body ng-controller="proctrl as pc">
<!-- 版心 -->
<div class="container">
  <div>
    <h1>商品管理<small>(共{{pc.proInfos.length}}类商品)</small>
    </h1>
  </div>
  <div>
    <div>
      <form class="form-inline" role="search">
        <div class="form-group">
          <label for="name">商品关键字:</label>
          <input type="text" id="name" class="form-control" placeholder="" ng-model="qryproName">
        </div>
        <div class="form-group">
          <label for="f_catalog">一级商品类别</label>
<<<<<<< HEAD
          <select id="f_catalog" class="selectpicker" title="请选择一项" data-live-search="true" data-size="5" onchange="firstChange()">
			<option value="0">选择一级菜单</option>
          </select>
          <label for="secondCategorieID">二级商品类别</label>
          <select id="secondCategorieID" class="selectpicker" title="请选择一项" data-live-search="true" data-size="5">
            <option value="0">选择二级菜单</option>
=======
>>>>>>> 2fe6d0b505d3a804b4f93de310a86947c764e05d

          <select id="f_catalog" class="selectpicker" ng-model="selectFirst" ng_options="item.firstCatelogName for item in pc.f_catalog" title="请选择一项" data-live-search="true" data-size="5">
            <option>--所有--</option>
          </select>
          <label for="s_catalog">二级商品类别</label>
          <select id="s_catalog" class="selectpicker" ng-model="selectSecond" ng_options="item2.name for item2 in pc.s_catalog | filter:{firstId:selectFirst.firstCatelogId}"  title="请选择一项" data-live-search="true" data-size="5">
            <option >--所有--</option>
          </select>
        </div>
        <button type="submit" class="btn btn-default" ng-click="searchpro();">查 询</button>
        <div style="float:right">
          <button class="btn btn-primary" data-toggle="modal" data-target="#demoModal">新增商品信息</button>
        </div>
      </form>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12 col-sm-12 hidden-xs">
      <table class="table table-striped">
        <thead>
        <tr>
          <th>序号</th>
          <th>商品编号</th>
          <th>商品名称</th>
          <th>展示图片</th>
          <th>现在价格</th>
          <th>市场价格</th>
          <th>商品介绍</th>
          <th>库存总量</th>
          <th>已售数量</th>
          <th>所属分类</th>
          <th>创建时间
            <span style="cursor:pointer" ng-click="sortedCol='-creatTime'; isReversed=false;">[降序]</span>
            <span style="cursor:pointer" ng-click="sortedCol='creatTime'; isReversed=false;">[升序]</span>
          </th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="pro in pc.proInfos|filter:{name:qryproName}| orderBy:sortedCol:isReversed" ng-dblclick="pc.preUpdatepro(pro.id);">
          <td>{{$index+1}}</td>
          <td>{{pro.id}}</td>
          <td>{{pro.name}}</td>
          <td>{{pro.image}}</td>
          <td>{{pro.commercialPrice}}</td>
          <td>{{pro.marketPrice}}</td>
          <td>{{pro.remark}}</td>
          <td>{{pro.stockQty}}</td>
          <td>{{pro.purchaseQty}}</td>
          <td>{{pro.secondCategorieID}}</td>
          <td>{{pro.creatTime}}</td>
          <td>
            <button class="btn btn-primary btn-sm" ng-click="pc.preUpdatePro($index);">修改</button>
            <button class="btn btn-danger btn-sm removepro" ng-click="pc.removepro($index)">删除</button>
          </td>
        </tr>
        <tbody>
      </table>
    </div>
  </div>
</div>
<div id="demoModal" class="modal fade" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" ng-bind="pc.modelTitle"></h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" >
          <div class="form-group">
            <label for="proname" class="col-sm-3 control-label">商品名</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="proname" placeholder="请输入商品名" ng-model="pc.newpro.name">
            </div>
          </div>
          <div class="form-group">
            <label for="fileUpload" ng-show="pc.showRegBtn" class="col-sm-3 control-label">上传图片</label>
            <div class="col-sm-9">
              <input type="file" class="form-control" ng-show="pc.showRegBtn" id="fileUpload" placeholder="请选择一张本地图片" >
            </div>
          </div>
          <div class="form-group">
            <label for="pro_price" class="col-sm-3 control-label">当前价格</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="pro_price" placeholder="请输入当前价格" ng-model="pc.newpro.commercialPrice">
            </div>
          </div>
          <div class="form-group">
            <label for="marketPrice" class="col-sm-3 control-label">市场价格</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="marketPrice" placeholder="请输入市场价格" ng-model="pc.newpro.marketPrice">
            </div>
          </div>
          <div class="form-group">
            <label for="remark" class="col-sm-3 control-label">简介</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="remark" placeholder="请输入简介" ng-model="pc.newpro.remark">
            </div>
          </div>
          <div class="form-group">
            <label for="stockQty" class="col-sm-3 control-label">库存总量</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="stockQty" placeholder="请输入库存总量" ng-model="pc.newpro.stockQty">
            </div>
          </div>
          <div class="form-group">
            <label for="purchaseQty" ng-show="pc.showUpdateBtn" class="col-sm-3 control-label">已售数量</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="purchaseQty" placeholder="请输入已售数量" ng-show="pc.showUpdateBtn" ng-model="pc.newpro.purchaseQty">
            </div>
          </div>
          <div class="form-group">
            <label for="new_f_catalog"  class="col-sm-3 control-label">一级商品类别</label>
            <div class="col-sm-3">
              <select id="new_f_catalog" class="selectpicker form-control" ng-model="new_selectFirst" ng_options="item3.firstCatelogName for item3 in pc.f_catalog" title="请选择一项" data-live-search="true" data-size="5">
                <option>--选择类别--</option>
              </select>
            </div>
            <label for="new_s_catalog" class="col-sm-3 control-label">二级商品类别</label>
            <div class="col-sm-3">

              <select id="new_s_catalog" class="selectpicker form-control" ng-model="new_selectSecond" ng_options="item4.name for item4 in pc.s_catalog | filter:{firstId:new_selectFirst.firstCatelogId}"  title="请选择一项" data-live-search="true" data-size="5">
                <option >--选择类别--</option>
              </select>
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary btn" ng-show="pc.showRegBtn" ng-click="pc.addpro(new_selectSecond.iD);">添 加</button>
        <button type="button" class="btn btn-primary" ng-show="pc.showUpdateBtn" ng-click="pc.updatepro(new_selectSecond.iD);">确认修改</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<script src="libs/jquery/jquery-3.2.1.js"></script>
<script src="libs/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="libs/angular/angular.js"></script>

<script type="text/javascript" src="js/product_manage.js"></script>

</body>
</html>

